#ifndef _CBSOCKET_ABSTRACTCALLBACK_H
#define _CBSOCKET_ABSTRACTCALLBACK_H

#include <unistd.h>

namespace cbsocket
{
    class AbstractCallback
    {
    public:
        AbstractCallback(int fd) : fd(fd) {}
        virtual ~AbstractCallback() { close(fd); }
        virtual void dataReady() {};
        virtual void writeReady() {};
        virtual void dataStop() {};
        virtual void error() {};
        virtual void hangUp() {};
        
        virtual bool needCleanUp() = 0;
        
        int getFd() const { return fd; }
        
    protected:
        int const fd;
        
    private:
        AbstractCallback(AbstractCallback const&);
        AbstractCallback& operator = (AbstractCallback const&);
    };
}

#endif
